package com.lun.blog.controller.web;

import com.lun.blog.pojo.Picture;
import com.lun.blog.service.PictureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author fangLJ
 * @creatTime 2021/3/7
 */
@Controller
@RequestMapping("/web/picture")
public class PicturesController {

    @Autowired
    PictureService pictureService;

    @GetMapping("/toPicture")
    public String toPicture(Model model){
        List<Picture> pictures = pictureService.findAll();
        model.addAttribute("pictures",pictures);
        return "picture";
    }
}
